<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">

<h:head>
	<title>Editare</title>
</h:head>
<h:body style="background-color:#CCFFE6">

	<h:form>

		<br />
		<div align="right"><h:commandButton value="Back"
			action="#{editIntrebareBean.home}"></h:commandButton> <h:commandButton
			value="Logout" action="#{administratorBean.logout}"></h:commandButton>
		</div>

		<h2 align="center" style="font-family: Comic Sans MS; color: #003900">Editare
		intrebare</h2>
		<br> </br>
		<br> </br>
		<br> </br>


		<h:messages style="color:red"></h:messages>
		<h:outputText value="Intrebare: "></h:outputText>
		<h:inputText titlu=" " value="#{editIntrebareBean.text}"
			required="true" label="Titlu" style="width: 492px; "></h:inputText>


	
					
			<br>
			</br>
			<h:outputText value="Tip: "></h:outputText>
			<h:selectOneMenu id="tip" value="#{editIntrebareBean.tip}" style="width: 135px; " onchange="submit()">
            <f:selectItem id="item1" itemLabel="Text" itemValue="1" />
            <f:selectItem id="item2" itemLabel="Alegere simpla" itemValue="3" />
            <f:selectItem id="item3" itemLabel="Alegere multipla" itemValue="2" /> 
           
            </h:selectOneMenu>

<h:panelGrid rendered="#{editIntrebareBean.tip!=1}">
		<br> </br>
	



            <br>
			</br>
			<br>
			</br>
	 <h:outputText value="Optiune noua: "></h:outputText>
	 <br>
	 </br>		
	 <h:inputText style="width: 389px; " value="#{editIntrebareBean.optiuneText}"></h:inputText>	
	 <br>
	 </br>
	 <h:outputText value="E cu comentariu: "></h:outputText>
	 <h:selectBooleanCheckbox value="#{editIntrebareBean.comentariu}"/> 
	 <br>
	 </br>
	 <br>
	 </br>
	<h:commandButton value="Adauga optiune noua" action="#{editIntrebareBean.addOptiune}"></h:commandButton>		
	<h3	style="font-family: Georgia; background-color: #003900; color: white; font-size: 23">Optiuni</h3>

		

	<h:dataTable
	            value="#{editIntrebareBean.optiuni}" var="optiune" 
	            styleClass="order-table"
    			headerClass="order-table-header"
                rowClasses="order-table-odd-row,order-table-even-row" >
            <h:column>
				<h:inputText titlu=" " value="#{optiune.text}" required="true"
					label="Titlu" style="width: 389px; " rendered="#{!optiune.markedForDelete}"></h:inputText>
					</h:column>
			<h:column>
				<f:facet name="header">E cu comentariu</f:facet>
				<h:selectBooleanCheckbox value="#{optiune.e_cu_comentariu}" rendered="#{!optiune.markedForDelete}"/>
			</h:column>
			<h:column>
				<f:facet name="header">Sterge</f:facet>
				<h:commandLink action="#{editIntrebareBean.delete}" rendered="#{!optiune.markedForDelete}">
					<f:setPropertyActionListener target="#{editIntrebareBean.optiuneSelectata}" value="#{optiune}" /> 

					<h:graphicImage value="x_button.png"
						style="height: 26px; width: 26px" />

				</h:commandLink>
			</h:column>
		</h:dataTable>
		</h:panelGrid>
		<br />
		<h:commandButton value="Salveaza"
			action="#{editIntrebareBean.saveIntrebare}"></h:commandButton>
	</h:form>
</h:body>
</html>